package com.itheima.cammon;

import lombok.Data;

/**
 * @date: 2022/11/20 11:51
 * @author: linying
 */

@Data
public class CommonResult {

    private Integer code;

    private String msg;

    private Object data;

    public CommonResult(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static CommonResult success() {
        return new CommonResult(1, "成功", null);
    }

    public static CommonResult success(String msg) {
        return new CommonResult(1, msg, null);
    }
    public static CommonResult success(String msg,Object date) {
        return new CommonResult(1, msg, date);
    }

    public static CommonResult success(Object data) {
        return new CommonResult(1, "成功", data);
    }

    public static CommonResult error(String msg) {
        return new CommonResult(0, msg, null);
    }
    public static CommonResult error(int code, String msg, Object data) {
        return new CommonResult(code,msg,data);
    }

    public static CommonResult success(int code, String msg, Object data) {
        //传上来三个值
        return new CommonResult(code,msg,data);
    }
}
